/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    cn-qingdao = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-beijing = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-chengdu = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-zhangjiakou = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-huhehaote = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-hangzhou = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-shanghai = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-shenzhen = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-heyuan = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-wulanchabu = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-hongkong = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-southeast-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-southeast-2 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-southeast-3 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-southeast-5 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    eu-west-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    us-west-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    us-east-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    eu-central-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    me-east-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    ap-south-1 = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    cn-shanghai-finance-1 = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-shenzhen-finance-1 = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    cn-north-2-gov-1 = 'wafopenapi.cn-hangzhou.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('waf-openapi', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AppOpenAckRequest {
  ack?: string(name='Ack'),
  appName?: string(name='AppName'),
  asyncMethod?: string(name='AsyncMethod'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  serviceId?: string(name='ServiceId'),
}

model AppOpenAckResponseBody = {
  requestId?: string(name='RequestId'),
}

model AppOpenAckResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AppOpenAckResponseBody(name='body'),
}

async function appOpenAckWithOptions(request: AppOpenAckRequest, runtime: Util.RuntimeOptions): AppOpenAckResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.ack)) {
    query['Ack'] = request.ack;
  }
  if (!Util.isUnset(request.appName)) {
    query['AppName'] = request.appName;
  }
  if (!Util.isUnset(request.asyncMethod)) {
    query['AsyncMethod'] = request.asyncMethod;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.serviceId)) {
    query['ServiceId'] = request.serviceId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'AppOpenAck',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function appOpenAck(request: AppOpenAckRequest): AppOpenAckResponse {
  var runtime = new Util.RuntimeOptions{};
  return appOpenAckWithOptions(request, runtime);
}

model CreateDomainConfigRequest {
  caller?: string(name='Caller'),
  domain?: string(name='Domain'),
  httpPort?: string(name='HttpPort'),
  httpToUserIp?: int32(name='HttpToUserIp'),
  httpsPort?: string(name='HttpsPort'),
  httpsRedirect?: int32(name='HttpsRedirect'),
  instanceId?: string(name='InstanceId'),
  isAccessProduct?: int32(name='IsAccessProduct'),
  isNonStandardPort?: int32(name='IsNonStandardPort'),
  loadBalancing?: int32(name='LoadBalancing'),
  protocols?: string(name='Protocols'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  rsType?: int32(name='RsType'),
  sourceIps?: string(name='SourceIps'),
}

model CreateDomainConfigResponseBody = {
  cname?: string(name='Cname'),
  requestId?: string(name='RequestId'),
}

model CreateDomainConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: CreateDomainConfigResponseBody(name='body'),
}

async function createDomainConfigWithOptions(request: CreateDomainConfigRequest, runtime: Util.RuntimeOptions): CreateDomainConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.caller)) {
    query['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.httpPort)) {
    query['HttpPort'] = request.httpPort;
  }
  if (!Util.isUnset(request.httpToUserIp)) {
    query['HttpToUserIp'] = request.httpToUserIp;
  }
  if (!Util.isUnset(request.httpsPort)) {
    query['HttpsPort'] = request.httpsPort;
  }
  if (!Util.isUnset(request.httpsRedirect)) {
    query['HttpsRedirect'] = request.httpsRedirect;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isAccessProduct)) {
    query['IsAccessProduct'] = request.isAccessProduct;
  }
  if (!Util.isUnset(request.isNonStandardPort)) {
    query['IsNonStandardPort'] = request.isNonStandardPort;
  }
  if (!Util.isUnset(request.loadBalancing)) {
    query['LoadBalancing'] = request.loadBalancing;
  }
  if (!Util.isUnset(request.protocols)) {
    query['Protocols'] = request.protocols;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.rsType)) {
    query['RsType'] = request.rsType;
  }
  if (!Util.isUnset(request.sourceIps)) {
    query['SourceIps'] = request.sourceIps;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateDomainConfig',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function createDomainConfig(request: CreateDomainConfigRequest): CreateDomainConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return createDomainConfigWithOptions(request, runtime);
}

model DeleteDomainConfigRequest {
  caller?: string(name='Caller'),
  domain?: string(name='Domain'),
  instanceId?: string(name='InstanceId'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DeleteDomainConfigResponseBody = {
  requestId?: string(name='RequestId'),
}

model DeleteDomainConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteDomainConfigResponseBody(name='body'),
}

async function deleteDomainConfigWithOptions(request: DeleteDomainConfigRequest, runtime: Util.RuntimeOptions): DeleteDomainConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.caller)) {
    query['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DeleteDomainConfig',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteDomainConfig(request: DeleteDomainConfigRequest): DeleteDomainConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteDomainConfigWithOptions(request, runtime);
}

model DescribeDomainNamesRequest {
  instanceId?: string(name='InstanceId'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescribeDomainNamesResponseBody = {
  domainNames?: {
    domainName?: [ string ](name='DomainName')
  }(name='DomainNames'),
  requestId?: string(name='RequestId'),
}

model DescribeDomainNamesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeDomainNamesResponseBody(name='body'),
}

async function describeDomainNamesWithOptions(request: DescribeDomainNamesRequest, runtime: Util.RuntimeOptions): DescribeDomainNamesResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDomainNames',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeDomainNames(request: DescribeDomainNamesRequest): DescribeDomainNamesResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDomainNamesWithOptions(request, runtime);
}

model DescribeDomainTransferConfigRequest {
  caller?: string(name='Caller'),
  domain?: string(name='Domain'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescribeDomainTransferConfigResponseBody = {
  cname?: string(name='Cname'),
  httpPort?: string(name='HttpPort'),
  httpsPort?: string(name='HttpsPort'),
  isOwned?: int32(name='IsOwned'),
  isWafActive?: int32(name='IsWafActive'),
  protocolType?: int32(name='ProtocolType'),
  protocols?: string(name='Protocols'),
  requestId?: string(name='RequestId'),
  sourceIps?: string(name='SourceIps'),
  wafAffectMode?: int32(name='WafAffectMode'),
}

model DescribeDomainTransferConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeDomainTransferConfigResponseBody(name='body'),
}

async function describeDomainTransferConfigWithOptions(request: DescribeDomainTransferConfigRequest, runtime: Util.RuntimeOptions): DescribeDomainTransferConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.caller)) {
    query['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDomainTransferConfig',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeDomainTransferConfig(request: DescribeDomainTransferConfigRequest): DescribeDomainTransferConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDomainTransferConfigWithOptions(request, runtime);
}

model DescribeDomainsRequest {
  domain?: string(name='Domain'),
  instanceId?: string(name='InstanceId'),
  page?: int32(name='Page'),
  pageSize?: int32(name='PageSize'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescribeDomainsResponseBody = {
  domains?: {
    domain?: [ string ](name='Domain')
  }(name='Domains'),
  pageInfo?: {
    currentPage?: int32(name='CurrentPage'),
    pageSize?: int32(name='PageSize'),
    total?: int32(name='Total'),
  }(name='PageInfo'),
  requestId?: string(name='RequestId'),
}

model DescribeDomainsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeDomainsResponseBody(name='body'),
}

async function describeDomainsWithOptions(request: DescribeDomainsRequest, runtime: Util.RuntimeOptions): DescribeDomainsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.page)) {
    query['Page'] = request.page;
  }
  if (!Util.isUnset(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeDomains',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeDomains(request: DescribeDomainsRequest): DescribeDomainsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeDomainsWithOptions(request, runtime);
}

model DescribeHttpsCertInUseRequest {
  domain?: string(name='Domain'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescribeHttpsCertInUseResponseBody = {
  certContent?: string(name='CertContent'),
  certId?: string(name='CertId'),
  certKey?: string(name='CertKey'),
  certName?: string(name='CertName'),
  requestId?: string(name='RequestId'),
}

model DescribeHttpsCertInUseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeHttpsCertInUseResponseBody(name='body'),
}

async function describeHttpsCertInUseWithOptions(request: DescribeHttpsCertInUseRequest, runtime: Util.RuntimeOptions): DescribeHttpsCertInUseResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeHttpsCertInUse',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeHttpsCertInUse(request: DescribeHttpsCertInUseRequest): DescribeHttpsCertInUseResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeHttpsCertInUseWithOptions(request, runtime);
}

model DescribeNeedUpgradeDomainLimitRequest {
  domain?: string(name='Domain'),
  instanceId?: string(name='InstanceId'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescribeNeedUpgradeDomainLimitResponseBody = {
  needUpgrade?: boolean(name='NeedUpgrade'),
  requestId?: string(name='RequestId'),
}

model DescribeNeedUpgradeDomainLimitResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeNeedUpgradeDomainLimitResponseBody(name='body'),
}

async function describeNeedUpgradeDomainLimitWithOptions(request: DescribeNeedUpgradeDomainLimitRequest, runtime: Util.RuntimeOptions): DescribeNeedUpgradeDomainLimitResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeNeedUpgradeDomainLimit',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeNeedUpgradeDomainLimit(request: DescribeNeedUpgradeDomainLimitRequest): DescribeNeedUpgradeDomainLimitResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeNeedUpgradeDomainLimitWithOptions(request, runtime);
}

model DescribePackageRequest {
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescribePackageResponseBody = {
  expireTime?: long(name='ExpireTime'),
  instanceId?: string(name='InstanceId'),
  requestId?: string(name='RequestId'),
  rules?: {
    rule?: [ string ](name='Rule')
  }(name='Rules'),
  version?: string(name='Version'),
}

model DescribePackageResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribePackageResponseBody(name='body'),
}

async function describePackageWithOptions(request: DescribePackageRequest, runtime: Util.RuntimeOptions): DescribePackageResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribePackage',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describePackage(request: DescribePackageRequest): DescribePackageResponse {
  var runtime = new Util.RuntimeOptions{};
  return describePackageWithOptions(request, runtime);
}

model DescribeQpsRequest {
  domain?: string(name='Domain'),
  endMillisecond?: long(name='EndMillisecond'),
  field?: [ string ](name='Field'),
  instanceId?: string(name='InstanceId'),
  interval?: int32(name='Interval'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  startMillisecond?: long(name='StartMillisecond'),
}

model DescribeQpsResponseBody = {
  items?: {
    qps?: [ string ](name='Qps')
  }(name='Items'),
  requestId?: string(name='RequestId'),
  timeScope?: {
    end?: long(name='End'),
    start?: long(name='Start'),
    step?: int32(name='Step'),
  }(name='TimeScope'),
}

model DescribeQpsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeQpsResponseBody(name='body'),
}

async function describeQpsWithOptions(request: DescribeQpsRequest, runtime: Util.RuntimeOptions): DescribeQpsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.endMillisecond)) {
    query['EndMillisecond'] = request.endMillisecond;
  }
  if (!Util.isUnset(request.field)) {
    query['Field'] = request.field;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.interval)) {
    query['Interval'] = request.interval;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.startMillisecond)) {
    query['StartMillisecond'] = request.startMillisecond;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeQps',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeQps(request: DescribeQpsRequest): DescribeQpsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeQpsWithOptions(request, runtime);
}

model DescribeRegionStatusRequest {
  instanceSource?: string(name='InstanceSource'),
  lang?: string(name='Lang'),
  region?: string(name='Region'),
  sourceIp?: string(name='SourceIp'),
}

model DescribeRegionStatusResponseBody = {
  inDebt?: int32(name='InDebt'),
  payType?: int32(name='PayType'),
  requestId?: string(name='RequestId'),
}

model DescribeRegionStatusResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeRegionStatusResponseBody(name='body'),
}

async function describeRegionStatusWithOptions(request: DescribeRegionStatusRequest, runtime: Util.RuntimeOptions): DescribeRegionStatusResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceSource)) {
    query['InstanceSource'] = request.instanceSource;
  }
  if (!Util.isUnset(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRegionStatus',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeRegionStatus(request: DescribeRegionStatusRequest): DescribeRegionStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRegionStatusWithOptions(request, runtime);
}

model DescribeRegionsRequest {
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescribeRegionsResponseBody = {
  regions?: {
    region?: [ string ](name='Region')
  }(name='Regions'),
  requestId?: string(name='RequestId'),
}

model DescribeRegionsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeRegionsResponseBody(name='body'),
}

async function describeRegionsWithOptions(request: DescribeRegionsRequest, runtime: Util.RuntimeOptions): DescribeRegionsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRegions',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeRegions(request: DescribeRegionsRequest): DescribeRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeRegionsWithOptions(request, runtime);
}

model DescribeTransferConfigInWorkRequest {
  checkRequestId?: string(name='CheckRequestId'),
  domain?: string(name='Domain'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model DescribeTransferConfigInWorkResponseBody = {
  requestId?: string(name='RequestId'),
  status?: string(name='Status'),
  wafRequestId?: string(name='WafRequestId'),
}

model DescribeTransferConfigInWorkResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeTransferConfigInWorkResponseBody(name='body'),
}

async function describeTransferConfigInWorkWithOptions(request: DescribeTransferConfigInWorkRequest, runtime: Util.RuntimeOptions): DescribeTransferConfigInWorkResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.checkRequestId)) {
    query['CheckRequestId'] = request.checkRequestId;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeTransferConfigInWork',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeTransferConfigInWork(request: DescribeTransferConfigInWorkRequest): DescribeTransferConfigInWorkResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeTransferConfigInWorkWithOptions(request, runtime);
}

model GetQpsRequest {
  instanceId?: string(name='InstanceId'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  e?: long(name='e'),
  f?: [ string ](name='f'),
  n?: string(name='n'),
  s?: long(name='s'),
  x?: int32(name='x'),
}

model GetQpsResponseBody = {
  code?: string(name='Code'),
  items?: {
    qps?: [ 
    {
      data?: {
        data?: [ string ](name='Data')
      }(name='Data'),
      name?: string(name='Name'),
    }
  ](name='Qps')
  }(name='Items'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  timeScope?: {
    end?: long(name='End'),
    start?: long(name='Start'),
    step?: int32(name='Step'),
  }(name='timeScope'),
}

model GetQpsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetQpsResponseBody(name='body'),
}

async function getQpsWithOptions(request: GetQpsRequest, runtime: Util.RuntimeOptions): GetQpsResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.e)) {
    query['e'] = request.e;
  }
  if (!Util.isUnset(request.f)) {
    query['f'] = request.f;
  }
  if (!Util.isUnset(request.n)) {
    query['n'] = request.n;
  }
  if (!Util.isUnset(request.s)) {
    query['s'] = request.s;
  }
  if (!Util.isUnset(request.x)) {
    query['x'] = request.x;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetQps',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getQps(request: GetQpsRequest): GetQpsResponse {
  var runtime = new Util.RuntimeOptions{};
  return getQpsWithOptions(request, runtime);
}

model GetQpsTotalRequest {
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  e?: long(name='e'),
  f?: [ string ](name='f'),
  instanceId?: string(name='instanceId'),
  n?: string(name='n'),
  s?: long(name='s'),
  x?: int32(name='x'),
}

model GetQpsTotalResponseBody = {
  code?: string(name='Code'),
  items?: {
    qps?: [ 
    {
      data?: {
        data?: [ string ](name='Data')
      }(name='Data'),
      name?: string(name='Name'),
    }
  ](name='Qps')
  }(name='Items'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  timeScope?: {
    end?: long(name='End'),
    start?: long(name='Start'),
    step?: int32(name='Step'),
  }(name='timeScope'),
}

model GetQpsTotalResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetQpsTotalResponseBody(name='body'),
}

async function getQpsTotalWithOptions(request: GetQpsTotalRequest, runtime: Util.RuntimeOptions): GetQpsTotalResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.e)) {
    query['e'] = request.e;
  }
  if (!Util.isUnset(request.f)) {
    query['f'] = request.f;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['instanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.n)) {
    query['n'] = request.n;
  }
  if (!Util.isUnset(request.s)) {
    query['s'] = request.s;
  }
  if (!Util.isUnset(request.x)) {
    query['x'] = request.x;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetQpsTotal',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getQpsTotal(request: GetQpsTotalRequest): GetQpsTotalResponse {
  var runtime = new Util.RuntimeOptions{};
  return getQpsTotalWithOptions(request, runtime);
}

model GetRegionListRequest {
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model GetRegionListResponseBody = {
  code?: string(name='Code'),
  data?: {
    regionInfo?: [ 
    {
      display?: string(name='Display'),
      region?: string(name='Region'),
    }
  ](name='RegionInfo')
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetRegionListResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetRegionListResponseBody(name='body'),
}

async function getRegionListWithOptions(request: GetRegionListRequest, runtime: Util.RuntimeOptions): GetRegionListResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetRegionList',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getRegionList(request: GetRegionListRequest): GetRegionListResponse {
  var runtime = new Util.RuntimeOptions{};
  return getRegionListWithOptions(request, runtime);
}

model ModifyCertAndKeyRequest {
  caller?: string(name='Caller'),
  cert?: string(name='Cert'),
  domain?: string(name='Domain'),
  httpsCertId?: string(name='HttpsCertId'),
  httpsCertName?: string(name='HttpsCertName'),
  key?: string(name='Key'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model ModifyCertAndKeyResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyCertAndKeyResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyCertAndKeyResponseBody(name='body'),
}

async function modifyCertAndKeyWithOptions(request: ModifyCertAndKeyRequest, runtime: Util.RuntimeOptions): ModifyCertAndKeyResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.caller)) {
    query['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.cert)) {
    query['Cert'] = request.cert;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.httpsCertId)) {
    query['HttpsCertId'] = request.httpsCertId;
  }
  if (!Util.isUnset(request.httpsCertName)) {
    query['HttpsCertName'] = request.httpsCertName;
  }
  if (!Util.isUnset(request.key)) {
    query['Key'] = request.key;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyCertAndKey',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyCertAndKey(request: ModifyCertAndKeyRequest): ModifyCertAndKeyResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyCertAndKeyWithOptions(request, runtime);
}

model ModifyDomainConfigRequest {
  caller?: string(name='Caller'),
  domain?: string(name='Domain'),
  httpPort?: string(name='HttpPort'),
  httpToUserIp?: int32(name='HttpToUserIp'),
  httpsPort?: string(name='HttpsPort'),
  httpsRedirect?: int32(name='HttpsRedirect'),
  instanceId?: string(name='InstanceId'),
  isAccessProduct?: int32(name='IsAccessProduct'),
  isNonStandardPort?: int32(name='IsNonStandardPort'),
  loadBalancing?: int32(name='LoadBalancing'),
  protocols?: string(name='Protocols'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  rsType?: int32(name='RsType'),
  sourceIps?: string(name='SourceIps'),
}

model ModifyDomainConfigResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyDomainConfigResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyDomainConfigResponseBody(name='body'),
}

async function modifyDomainConfigWithOptions(request: ModifyDomainConfigRequest, runtime: Util.RuntimeOptions): ModifyDomainConfigResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.caller)) {
    query['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.httpPort)) {
    query['HttpPort'] = request.httpPort;
  }
  if (!Util.isUnset(request.httpToUserIp)) {
    query['HttpToUserIp'] = request.httpToUserIp;
  }
  if (!Util.isUnset(request.httpsPort)) {
    query['HttpsPort'] = request.httpsPort;
  }
  if (!Util.isUnset(request.httpsRedirect)) {
    query['HttpsRedirect'] = request.httpsRedirect;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.isAccessProduct)) {
    query['IsAccessProduct'] = request.isAccessProduct;
  }
  if (!Util.isUnset(request.isNonStandardPort)) {
    query['IsNonStandardPort'] = request.isNonStandardPort;
  }
  if (!Util.isUnset(request.loadBalancing)) {
    query['LoadBalancing'] = request.loadBalancing;
  }
  if (!Util.isUnset(request.protocols)) {
    query['Protocols'] = request.protocols;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.rsType)) {
    query['RsType'] = request.rsType;
  }
  if (!Util.isUnset(request.sourceIps)) {
    query['SourceIps'] = request.sourceIps;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDomainConfig',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyDomainConfig(request: ModifyDomainConfigRequest): ModifyDomainConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDomainConfigWithOptions(request, runtime);
}

model ModifyDomainPackageCountRequest {
  domainPackageCount?: int32(name='DomainPackageCount'),
  instanceId?: string(name='InstanceId'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
}

model ModifyDomainPackageCountResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyDomainPackageCountResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyDomainPackageCountResponseBody(name='body'),
}

async function modifyDomainPackageCountWithOptions(request: ModifyDomainPackageCountRequest, runtime: Util.RuntimeOptions): ModifyDomainPackageCountResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.domainPackageCount)) {
    query['DomainPackageCount'] = request.domainPackageCount;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyDomainPackageCount',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyDomainPackageCount(request: ModifyDomainPackageCountRequest): ModifyDomainPackageCountResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyDomainPackageCountWithOptions(request, runtime);
}

model ModifyWafSwitchRequest {
  caller?: string(name='Caller'),
  domain?: string(name='Domain'),
  instanceId?: string(name='InstanceId'),
  region?: string(name='Region'),
  resourceOwnerId?: long(name='ResourceOwnerId'),
  serviceOn?: int32(name='ServiceOn'),
}

model ModifyWafSwitchResponseBody = {
  requestId?: string(name='RequestId'),
}

model ModifyWafSwitchResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ModifyWafSwitchResponseBody(name='body'),
}

async function modifyWafSwitchWithOptions(request: ModifyWafSwitchRequest, runtime: Util.RuntimeOptions): ModifyWafSwitchResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.caller)) {
    query['Caller'] = request.caller;
  }
  if (!Util.isUnset(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.region)) {
    query['Region'] = request.region;
  }
  if (!Util.isUnset(request.resourceOwnerId)) {
    query['ResourceOwnerId'] = request.resourceOwnerId;
  }
  if (!Util.isUnset(request.serviceOn)) {
    query['ServiceOn'] = request.serviceOn;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ModifyWafSwitch',
    version = '2017-09-30',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function modifyWafSwitch(request: ModifyWafSwitchRequest): ModifyWafSwitchResponse {
  var runtime = new Util.RuntimeOptions{};
  return modifyWafSwitchWithOptions(request, runtime);
}

